<?php
// +----------------------------------------------------------------------
// Csmmeet [ Csmonline ]
// Author: chensm <chenshiming0802@163.com>
// Create by chensm at 2020-03-31
// +----------------------------------------------------------------------
namespace app\admin\controller\csmonline;

use app\common\controller\Backend;
use addons\csmonline\library\CsmonlineCron;

/**
 * Tables
 * http://127.0.0.1/fastadmin_plugin_csmmeet/public/q3HJDu2RgE.php/csmonline/tableonlinetrace/index
 */
class Tableonlinetrace extends Backend
{

    protected $model = null;

    protected $relationSearch = true;

    /**
     * 查看
     */
    public function index($ids = null)
    {
        $userid = $ids;
        if ($this->request->isAjax()) {
            $yestoday = date("Y-m-d", strtotime("-1 day"));
            $firstid = CsmonlineCron::getUserLogFirstId($yestoday);
            list ($where, $sort, $order, $offset, $limit) = $this->buildparams();
            $dao = new \app\admin\model\csmonline\Userlog();
            $total = $dao->alias('t')
                ->
            // ->join("category a", "a.id=category_id", "left")
            where($where)
                ->order($sort, $order)
                ->count();
            $list = $dao->alias('t')
                ->
            // ->join("category a", "a.id=category_id", "left")
            where($where)
                ->where("id", ">=", $firstid)
                ->order($sort, $order)
                ->limit($offset, $limit)
                ->select();
            // echo $dao->getLastSql();die();
            $result = array(
                "total" => $total,
                "rows" => $list
            );
            return json($result);
        }
        $this->assign("userid", $userid);
        return $this->view->fetch();
    }
}